package cards;

import java.util.Scanner;

public class Problem{
	
	private Candidates candidates;
	private Solution solution;
	private Scanner	reader;
    
	public Problem(){
		this.candidates	= 	new Candidates();
		this.solution	= 	new Solution();
		this.reader		= 	new Scanner(System.in);
	}
	
    public void solve(){
    	//System.out.println(candidates);
    	//System.out.println(solution);
    	//reader.nextLine();
    	int index = 0;
    	while( index < candidates.size() ){
    		if(solution.fits( candidates.get(index) ) ){
    			solution.record(candidates.remove(index)); //move candidate to solution
    			if( solution.complete() ){
    				solution.show();
    			}else{
    				solve();
    			}
    			candidates.add(index, solution.eraseRecording()); //move candidate to candidates
             }
    		index++;
        	}
    	}

    public static void main(String[] args){
        Problem problem = new Problem();
        problem.solve();
    }
}
        
          
         









